import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-06-23
 * Time: 23:36
 */
public class Test2 {

    public static List<List<String>> group(String[] str) {

        HashMap<String,List<String>> hash = new HashMap<>();

        for(int i = 0; i < str.length; i++) {
            char[] ch = str[i].toCharArray();
            Arrays.sort(ch);
            String key = new String(ch);
            if(!hash.containsKey(key)) {
                hash.put(key,new ArrayList<>());
            }
            hash.get(key).add(str[i]);
        }
        return new ArrayList<>(new ArrayList<>(hash.values()));
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        String[] str = input.split(",");
        List<List<String>> ret = group(str);
        System.out.println(ret);
    }

}
